// 引用用户请求api
import userApi from "@/api/user.js"
import {
	setToken
} from "../../utils/auth";
export default {
	namespaced: true,
	state: {
		showQueuing: true, // 展示排队页面
		slideshow: [], // 轮播图
		category: {}, // 产品分类 以及 分类下的产品
		showGoodSelect: false, // 展示产品介绍弹窗
		showGoodSpec: false, // 展示单品选规格弹窗
		showGoodCompose: false, // 展示产品套餐弹窗
		currentGood: {} // 选择规格页面使用的数据
	},
	// 同步操作 调用方法 commit
	mutations: {
		// 轮播图
		setSlideshow (state, val) {
			state.slideshow = val
		},
		// 产品分类和产品相关
		setCategory (state, val) {
			state.category = val
		},
		// 设置规格页面
		setUnitItem (state, val) {
			state.showGoodSelect = val.showGoodSelect
			state.showGoodSpec = val.showGoodSpec
			state.currentGood = val.currentGood
			state.showGoodCompose = val.showGoodCompose
		},
		// 改变当前选中的规格
		setCurrentGood(state, val) {
			state.currentGood = val
		},

		// 开启关闭规格弹窗

		setShowGoodSpec (state,val) {
			state.showGoodSpec = val
		},

		// 开启关闭产品详情弹窗
		setShowGoodSelect (state,val) {
			return new Promise((resolve, reject) => {
				state.showGoodSelect = val
				resolve(true)
			})

		},

		// 开启关闭产品套餐
		setShowGoodCompose (state,val)  {
			state.showGoodCompose = val
		},

		// 是否开启或者关闭假的排队页面
		setShowQueuing (state, val) {
			state.showQueuing = val
		}
	},
	// 异步操作
	actions: {
	}
};
